<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        body {
            height: 4000px;
        }

        .box {
            position: fixed;
            top: 30px;
            left: 30px;
            border: 1px solid #888;
            background: #666;
        }
    </style>
</head>

<body>
    <div class="box">dianwo</div>

    <script>
        console.log(window.innerWidth, window.innerHeight)  //浏览器可视窗口
        console.log(window.outerWidth, window.outerHeight)

        window.onscroll = () => {
            console.log(document.documentElement.scrollTop)
            console.log(window.scrollY)
        }

        let box = document.querySelector(".box")
        box.onclick = () => {
            confirm("")
        }
    </script>
</body>

</html>